package com.webflux.dmeo.functionCompileDemo;

import java.util.stream.IntStream;

/**
 * Created by wangzhanjin on 2018/5/30.
 */
public class MaintDemo {

    public static void main(String[] args) {
        int[] nums = {1, 2, 3, 4, -11, 12};
        int min = Integer.MAX_VALUE;
        //多线程比较麻烦，这里要线程池，拆数据
        for (int i : nums) {
            if (i < min) {
                min = i;
            }
        }
        System.out.println(min);
        //parallel直接多线程处理掉了，线程池，等，思想层面
        int min2 = IntStream.of(nums).parallel().min().getAsInt();
        System.out.println(min2);

    }
}
